const getters = {
    // 获取token
    token: state => state.token,
    
    // 获取用户信息
    userInfo: state => state.userInfo,
    
    // 获取登录状态
    isLogin: state => state.isLogin,

    // 获取手机号
    phone: state => state.phone,

    // 订单相关
    selectedMaster: state => state.selectedMaster,
    reservation: state => state.reservation,
    selectedSpec: state => state.selectedSpec,
    
    // 地址相关，仅保留当前选中地址（不回退到默认）
    selectedAddress: state => state.selectedAddress,
    // 当前选中地址（不回退到默认）
    currentAddress: state => state.selectedAddress,
    // 获取地址列表
    addressList: state => state.addressList,
    // 获取默认地址
    defaultAddress: state => {
        if (state.defaultAddressId) {
            return state.addressList.find(item => Number(item.id) === Number(state.defaultAddressId)) || null;
        }
        return null;
    },
    // 获取标签列表
    tagList: state => state.tagList,
    addressUrl:state => state.addressUrl,
    // 小区选择
    selectedCity: state => state.selectedCity
}

export default getters;